let path = require('path');
let HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
  //多入口（index.js和other.js），就需要写成对象。
  mode: 'development',
  entry: {
    home: './src/index.js',
    other: './src/other.js'
  },
  output: {
    //[name] home、other分别打包
    filename: '[name].js',
    path: path.resolve(__dirname,'dist')
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: './index.html',//选择一个模板
      filename: 'home.html',
      chunks: ['home']
    }),
    new HtmlWebpackPlugin({
      template: './index.html',
      filename: 'other.html',
      chunks: ['other']
    }),
  ]
} 